@RestResource(urlMapping='/tpm/test')
global with sharing class TestRestController {
    @HttpGet
    global static String randomName() {
        String[] names = new String[]{'John', 'Ting', 'Jim', 'Tom'};
        Integer idx = Math.floor(Math.random() * names.size()).intValue();
        String retName = names.get(idx);
        System.debug('retName: ' + retName);
        return retName;
    }

    @HttpPost
    global static String postHandler() {
        System.debug('params: ' + Restcontext.request.params);
        return 'OK';
    }
}